fathertoastfandomcom-20200214-history
Custom Chest Loot
This mod allows you to customize all loot lists, vanilla or otherwise, and even add your own lists. Many properties accept number ranges for values, and are randomized for each item generated. Everything in this mod is completely configurable. This mod will do nothing if you do not edit its properties files. The properties files are generated in your .minecraft/config directory. The properties files use a format known as JSON (JavaScript Object Notation). You can find specs and examples of JSON on the JSON website and various tutorials scattered throughout the internet. This page will assume you understand JSON enough to write a file and know what I mean when I say "object", "array", "name", and "value". How To Use Install the mod and start Minecraft once to generate five files in your config folder: CustomChestLoot.cfg - the general properties for the mod. CustomChestLoot - the folder where all of your loot list files are stored. Should be full of auto-generated loot lists at this point. CustomChestLootExternal - the folder that houses all of your external functions. This will be covered more later. CustomChestLootInfo - the folder where loot files are generated when using /cclinfo. This won't show up until you use the command. You probably won't need to mess with the general .cfg file. The few things inside are self-explanatory, so I won't be going over them here. Open up your CustomChestLoot folder (.minecraft/config/CustomChestLoot). You will see that the mod has already generated a file for each registered chest type - including any added by mods that use Forge's ChestGenHooks system. You may reorganize the files into folders however you want and even may add entirely new files, which will be loaded into the game to be usable by other mods that let you specify loot lists (such as Mob/Block Properties). You can open up JSON files with any text editor, or you can use any JSON or JavaScript program to help you write them. I recommend this online editor to write your properties files with. It's simple, effective, free, and doesn't require a download. When you open up one of the generated loot files, you'll see it has four basic parts to it: "_name", "min", "max", and "loot". The value of "_name" is the string id of the chest type the file will apply to. Only one file may exist for any string loot id. "min" and "max" are the minimum and maximum number of times to place a loot entry from "loot" into each chest being generated. "loot" is the array which contains all of your loot entries, each one of which represents an item (or items) that can be generated in the chest; one of these is chosen at random for each item generated in the chest. Advanced loot entries can have some or all of themselves be determined by functions. Functions can do anything from giving the item a random name, to changing the item below a certain y-value, to actually being multiple items. Function objects are what alter the items generated by loot entries. A function object is simply an object containing the field "function" with a value equal to the string name of the function you want to use, along with any required and optional name/value pairs associated with that function. Any function object can be used as an external function. It must be saved in its own .json file and placed in the subfolder of CustomChestLootExternal that fits its context. For example, a function that edits nbt data should go in CustomChestLootExternal/nbt. Throughout the tables below, you will see some fields say (number range). This means that those fields accept single numbers as numbers or strings, or two string numbers separated by a tilde (~). Any of these numbers may be represented as hexidecimal by prefixing the hex number with "0x". A number range will randomly be one of the two numbers, or any number in between. If a fractional number is used where an integer is needed, one of the two nearest integers is chosen at random, weighted towards the closer one (e.g., "0.3" has a 30% chance to be 1 and a 70% chance be be 0). All random decisions are made on a per-item basis (from the above example, "0.3" will be 1 for 30% of generated items and 0 for the remaining 70% of items). You may place a comment anywhere except in arrays. To do this, just make a string field called "_comment" and for its value, type whatever you want in quotations (e.g., "_comment":"This is a comment!"). Feel free to place multiple comments in one place -the overlapping of names will not matter because comments are ignored by the mod. Loot Entries Each object in the "loot" array of a loot list file is called a loot entry. A loot entry is an object with a few fields that define the item and the chance of it occurring in a chest. Below is information about each field that can be included in a loot entry. Quick Reference entry type: required_field* optional_field etc. simple: id* damage weight min max advanced: id damage weight min max enchant enchant_chance external functions keep: keep* id damage nbt count Full Table Universal Functions These functions can be used anywhere that functions are accepted. Universal functions are generally logicals, conditionals, or loops. Quick Reference function: required_field* optional_field etc. all: functions* count choose: functions* count if_X: functions* count external: file* count conditionals: if_is_tile_entity_X if_check_nbt_X if_raining if_thundering if_moon_phase_X if_beyond_X if_difficulty_X if_past_world_difficulty_X if_past_day_time_X if_past_world_time_X if_in_dimension_X if_in_biome_X if_touching_block_X if_below_X if_in_biome_X if_in_biome_type_X if_biome_temp_X if_biome_height_below_X if_is_humid if_rainfall_above_X if_temp_above_X if_biome_temp_above_X if_player_online_X Full Table If Function The if_X function is a function which performs exactly like the all, but does not do anything at all if its condition is not met. The condition is determined by the name you use for the if_X function. Using an exclamation mark at the beginning of the function inverts its behavior, then only performing functions if its condition is NOT met. Some conditions require additional input, such as if_in_dimension_X, where you must replace the X'' with your input (in this case, an integer). Remember that these conditions are checked when the chest is generated, so time/weather-based conditionals may not be good choices in naturally generating chests, but may be very useful for chests generated by player actions (e.g., using Mob Properties to spawn a chest with a custom loot list as a mob drop). Functions: function: condition if_is_tile_entity_X: if the tile entity the loot is generating in has the savegame id of X if_check_nbt_X: if the nbt comparison is true (see below) if_raining: if it is currently raining if_thundering: if there is currently a thunderstorm if_can_see_sky: if the block has a direct view of the sky if_moon_phase_X: if the moon is currently in phase X (X is full, waning_gibbous, third_quarter, waning_crescent, new, waxing_crescent, first_quarter, or waxing_gibbous) if_beyond_X: if the block is farther than X blocks from the world spawn point if_difficulty_X: if the difficulty is set to X (X is peaceful, easy, normal, or hard) if_past_world_difficulty_X: if the Apocalypse mod is installed, if the world difficulty is greater than X if_past_day_time_X: if the day time is greater than X (varies from 0 to 23999) if_past_world_time_X: if the total world time is greater than X if_in_dimension_X: if the block is in dimension X (X is an integer dimension id) if_in_biome_X: if the block is in biome X (X is an integer biome id) if_touching_block_X: if the block is adjacent to X (X is a string block id) if_below_X: if the block is below layer X (X is an integer block height) if_in_biome_X: if the mob is in biome X (X is a biome's name exactly as shown in F3) if_in_biome_type_X: if the mob is in a biome similar to X (see below) if_biome_temp_X: if the biome temperature is in the X category (X is cold, medium, or warm) temp ranges: (-0.5)- cold -(0.1)- invalid/cold -(0.2)- medium -(1.0)- hot -(2.0) if_biome_height_below_X: if the biome's base height is below X blocks (see below for standard heights) if_is_humid: if the biome is considered humid (normally rainfall > 0.85) if_rainfall_above_X: if the biome's rainfall is greater than X if_temp_above_X: if the temperature at the entity's location is above X (same as biome temp below 65 blocks, above 65 blocks decreses by a random amount, then -0.001667 for each block above 64) if_biome_temp_above_X: if the biome's standard sea-level temperature is greater than X (water freezes below 0.2) if_player_online_X: if the player with username X is in the world if_check_nbt_X: For checking nbt tag values, X is the path of the tag, followed by , >, <, >=, or <=, and then by the value to compare to. String tags can only be compared using . For example, you want to check if the integer value called "Value", which is contained inside the "ForgeData" compound, is greater than or equal to 1 - you would use "if_check_nbt_ForgeData/Value>=1". Values and compounds in lists are represented by their index in that list (the first index is 0, then 1, and so on). For an example using a list, we can check if the harvester is below the y-level 16 by using "if_check_harvester_nbt_Pos/1<16" (in the "Pos" list, index 0 is the x position, index 1 is the y, and index 2 is the z) (Note: harvester function not supported in Custom Chest Loot). if_in_biome_type_X: The vanilla biome types are beach, desert, end, forest, hell, hills, jungle, mesa, mushroom, ocean, plains, river, savanna, snow, stone_beach, swamp, and taiga. Hills refers specifically to extreme hills, and hell is the Nether's biome. The type can also be the normal name of any biome in a type - this allows you to still use mod-added biomes and consider them as "types". if_biome_height_below_X: Sea level is at 64 blocks in default world generation. In addition to using normal y-values, you can also compare the biome height with the generic heights used by vanilla (e.g., "if_biome_height_below_default"). (y) name (6) deep_oceans (32) oceans (48) shallow_waters (57) partly_submerged (64) shores (67) rocky_waters (67) default (68) low_plains (70) mid_plains (70) low_islands (78) low_hills (96) mid_hills (112) high_plateaus Item Stats Functions These functions can be used in any array with the name "item_stats". Item stats functions alter item stacks by editing their nbt tag. Quick Reference function: required_field* optional_field etc. loot: id damage min max enchant enchant_chance external functions name: value* modifier: attribute* value* operator potion: id* amplifier duration ambient nbt: tags* enchant: id level lore: value* color: value Full Table Item Name Codes Include these anywhere in the value field of the ''name function to be replaced by randomized text. *''~c'' - Complete. Generates an entire name. If capitalized, it will base the name on one of the item's enchantments or modifiers (eventually - this is a WIP). *''~i'' - Info. Generates a name describing what the item is. Randomizes the name of the material and tool if they are not added by a mod. *''~p'' - Prefix. Generates an item prefix. If capitalized, it will base the name on one of the item's enchantments or modifiers (at least, it will - this is a WIP). *''~s'' - Postfix. Generates an item postfix. If capitalized, it will base the name on one of the item's enchantments or modifiers (at least, it will - this is a WIP). *''~d'' - Descriptor. Generates a describing word. Generally, you will want to precede this code with "NAME the ". *''~m'' - Mash. Generates a random name from the mash word generator. (Just jumbles up syllables.) *''~n'' - Normal. Generates a normal name from the list of pre-defined names. NBT Functions These functions can be used in any array with the name "tags". NBT functions represent NBT tags saved as an entity or item stack's tag compound. Using these, you can do just about anything. Make sure you know what you are doing when using these. Using the wrong data type or trying to put multiple data types in a tag list will crash your game and may even corrupt your world. For info on vanilla entities, see here. For items, see here. Use /bpreload to give yourself a stick that can convert nbt data of in-game entities and tile entities to an nbt function! Quick Reference function: required_field* optional_field etc. compound: name tags list: name tags : name value delete: name chest_loot: name loot inventory_size count item_id: name value* potion_id: name value* enchant_id: name value* types: string boolean byte byte_array short int int_array long float double Full Table Examples There's no way I could expect you to memorize all of the functions. If I were you, I would go to the quick reference section of each function section and copy/paste them all into a text document so you don't need to come back here and look through them. (Make sure you update it as new versions are released - the changelog will definitely tell you if any functions are added or implemented in an update!) To be continued... Appendix Below are useful resources and information from other places compiled into one handy location. Yay! *Recommended JSON editor http://www.jsoneditoronline.org/ *Vanilla item/block ids, item damage values, and block metadata http://minecraft.gamepedia.com/Data_values *Vanilla attributes http://minecraft.gamepedia.com/Attribute *Vanilla entity NBT format http://minecraft.gamepedia.com/Chunk_format#Entity_Format *Vanilla item NBT format http://minecraft.gamepedia.com/Player.dat_Format#Item_structure *Text formatting codes (use "\u00a7" for "§") http://minecraft.gamepedia.com/Formatting_codes Added Commands /cclreload - reloads all chest loot files /ccltest - reloads files and generates a chest at your feet with the specified loot list /cclinfo - generates a json file for the item in your hand, ready to be added to a "loot" array Vanilla Tile Entity Ids Furnace Furnace (Trapped) Chest Chest Ender Chest EnderChest Jukebox RecordPlayer Dispenser Trap Dropper Dropper Sign Sign Monster Spawner MobSpawner Note Block Music Piston Piston Brewing Stand Cauldron Enchantment Table EnchantTable End Portal Frame Airportal Command Block Control Beacon Beacon Mob Head Skull Daylight Detector DLDetector Hopper Hopper Comparator Comparator Flower Pot FlowerPot Vanilla Potion Ids Speed potion.moveSpeed Slowness potion.moveSlowdown Haste potion.digSpeed Mining Fatigue potion.digSlowDown Strength potion.damageBoost Weakness potion.weakness Instant Health potion.heal Instant Damage potion.harm Jump Boost potion.jump Nausea potion.confusion Regeneration potion.regeneration Resistance potion.resistance Fire Resistance potion.fireResistance Water Breathing potion.waterBreathing Invisibility potion.invisibility Blindness potion.blindness Night Vision potion.nightVision Hunger potion.hunger Poison potion.poison Wither potion.wither Health Boost potion.healthBoost Absorption potion.absorption Saturation potion.saturation Vanilla Enchantment Ids Sharpness enchantment.damage.all Smite enchantment.damage.undead Bane of Arthropods enchantment.damage.arthropods Knockback enchantment.knockback Fire Aspect enchantment.fire Protection enchantment.protect.all Fire Protection enchantment.protect.fire Feather Falling enchantment.protect.fall Blast Protection enchantment.protect.explosion Projectile Protection enchantment.protect.projectile Respiration enchantment.oxygen Aqua Affinity enchantment.waterWorker Efficiency enchantment.digging Silk Touch enchantment.untouching Unbreaking enchantment.durability Looting enchantment.lootBonus Fortune enchantment.lootBonusDigger Luck of the Sea enchantment.lootBonusFishing Lure enchantment.fishingSpeed Power enchantment.arrowDamage Flame enchantment.arrowFire Punch enchantment.arrowKnockback Infinity enchantment.arrowInfinite Thorns enchantment.thorns Category:Custom Chest Loot